{{define "Title"}}设置{{end}}
{{define "ContentWidth"}}9{{end}}
{{define "Breadcrumb"}}
<ul class="breadcrumb">
  <li><a href="/"><i class="glyphicon glyphicon-home"></i> 首页</a></li>
  <li class="active">设置</li>
</ul>
{{end}}
{{define "Content"}}
<div class="content">
  <form action="/profile" method="post" class="form-horizontal" role="form">
	<div class="form-group">
	  <label class="col-lg-2 control-label">用户名</label>
	  <div class="col-lg-6">
        <p class="form-control-static">{{.user.Username}}</p>
	  </div>
	</div>
    {{$email := .profileForm.Field "email"}}
    <div class="form-group">
      {{$email.RenderLabel `class="col-lg-2 control-label"`}}
      <div class="col-lg-10">
        {{$email.RenderInput `class="form-control"`}}
      </div>
    </div>
    {{$website := .profileForm.Field "website"}}
    <div class="form-group">
      {{$website.RenderLabel `class="col-lg-2 control-label"`}}
      <div class="col-lg-10">
        {{$website.RenderInput `class="form-control"`}}
      </div>
    </div>
    {{$location := .profileForm.Field "location"}}
    <div class="form-group">
      {{$location.RenderLabel `class="col-lg-2 control-label"`}}
      <div class="col-lg-10">
        {{$location.RenderInput `class="form-control" placeholder="城市名即可，无须省"`}}
      </div>
    </div>
    {{$tagline := .profileForm.Field "tagline"}}
    <div class="form-group">
      {{$tagline.RenderLabel `class="col-lg-2 control-label"`}}
      <div class="col-lg-10">
        {{$tagline.RenderInput `class="form-control"`}}
      </div>
    </div>
    {{$bio := .profileForm.Field "bio"}}
    <div class="form-group">
      {{$bio.RenderLabel `class="col-lg-2 control-label"`}}
      <div class="col-lg-10">
        {{$bio.RenderInput `class="form-control"`}}
      </div>
    </div>
	<hr>
    {{$github_username := .profileForm.Field "github_username"}}
    <div class="form-group">
      {{$github_username.RenderLabel `class="col-lg-2 control-label"`}}
      <div class="col-lg-10">
        {{$github_username.RenderInput `class="form-control"`}}
      </div>
    </div>
    {{$weibo := .profileForm.Field "weibo"}}
    <div class="form-group">
      {{$weibo.RenderLabel `class="col-lg-2 control-label"`}}
      <div class="col-lg-10">
        <div class="input-group">
          <span class="input-group-addon">http://weibo.com/</span>
          {{$weibo.RenderInput `class="form-control"`}}
        </div>
      </div>
    </div>

    <div class="form-group">
      <div class="col-lg-offset-2 col-lg-10">
        <input type="submit" class="btn btn-primary" value="保存设置">
      </div>
    </div>
  </form>
</div>

<div class="content">
  <h4 id="avatar"><small>头像</small></h4>
  <hr>
  <p>使用<a href="http://www.qiniu.com/" target="_blank">七牛云存储</a>和 <a href="http://identicon.relucks.org/" target="_blank">Identicon</a> 提供头像服务.</p>
  <p>
	当前头像
	<img class="img-rounded" src="{{.user.AvatarImgSrc 96}}">
	<img class="img-rounded" src="{{.user.AvatarImgSrc 48}}">
	<img class="img-rounded" src="{{.user.AvatarImgSrc 24}}">
  </p>
  <p>
	<br>
	<a href="/profile/avatar/gravatar" class="btn btn-primary">从Gravatar获取</a>
	<br>
  </p>
  <ul class="nav nav-tabs" id="avatar-tab" style="margin-bottom: 15px;">
	<li class="active"><a href="#upload">上传头像</a></li>
	<li><a href="#default">选择默认头像</a></li>
  </ul>
  <div class="tab-content">
    <div id="upload" class="tab-pane active fade in">
	  <form action="/profile/avatar" method="post" enctype="multipart/form-data" class="form-horizontal">
		<div class="form-group">
		  <label class="control-label col-lg-2" for="file">选择图片文件</label>
		  <div class="col-lg-10">
			<input type="file" name="file" id="file">
			<span class="help-block">支持 500K 以内的 jpg/png 文件</span>
		  </div>
		</div>
        <div class="form-group">
          <div class="col-lg-offset-2 col-lg-10">
            <button type="submit" class="btn btn-success">上传新头像</button>
          </div>
        </div>
	  </form>
	</div>
	<div id="default" class="tab-pane fade row-fluid">
	  <form action="/profile/choose_default_avatar" method="post">
        <div class="form-group">
		  <ul class="list-inline">
			{{$user := .user}}
			{{range .defaultAvatars}}
			<li>
			  <label>
				<input type="radio" name="defaultAvatars" value="{{.}}"{{if $user.IsDefaultAvatar .}} checked{{end}}>
				<img class="img-rounded" src="http://77fkk5.com1.z0.glb.clouddn.com/avatar/{{.}}-middle">
			  </label>
			</li>
			{{end}}
		  </ul>
		  <div class="control-group">
			<div class="controls">
			  <button type="submit" class="btn btn-success">选择头像</button>
			</div>
		  </div>
        </div>
	  </form>
	</div>
  </div>
</div>

<script type="text/javascript">
  $('#avatar-tab a').click(function (e) {
    e.preventDefault();
    $(this).tab('show');
  });
</script>
{{end}}

{{define "LeftSide"}}{{end}}
{{define "RightSide"}}{{end}}
